﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Infrastructure
{
    [AttributeUsage(AttributeTargets.Property, Inherited = true)]
    public class ModelFieldForeignIdAttribute : Attribute
    {
        private readonly string idFieldName = null; 

        /// <summary>
        /// 
        /// </summary>
        /// <param name="_idFieldName">ID字段名称</param> 
        public ModelFieldForeignIdAttribute(string idFieldName)
        {
            if (string.IsNullOrEmpty(idFieldName))
            {
                throw new Exception("idFieldName is null");
            }

            this.idFieldName = idFieldName;
        }

        /// <summary>
        /// ID字段名称
        /// </summary> 
        public string IdFieldName
        {
            get { return idFieldName; }
        }
    }
}
